/**
 * 
 */
package root.board.pieces;

import java.util.ArrayList;

import root.board.Piece;
import root.board.moviment.Moviment;
import root.board.moviment.Position;

/**
 * @author Calebe
 * 
 */
public class Bishop extends Piece {

	/**
	 * 
	 */
	public Bishop() {
		super();
	}

	/**
	 * 
	 */
	public Bishop(int team) {
		super(team);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see root.board.PieceInterface#moviments(int, int)
	 */
	@Override
	public Moviment[] moviments(int x, int y) {
		ArrayList<Moviment> moviments = new ArrayList<Moviment>();
		// quadrante 1
		for (int xStart = x, yStart = y; xStart < 7 && yStart > 0;) {
			moviments.add(new Moviment(new Position(x, y), new Position(++xStart, --yStart)));
		}
		// quadrante 2
		for (int xStart = x, yStart = y; xStart < 7 && yStart < 7;) {
			moviments.add(new Moviment(new Position(x, y), new Position(++xStart, ++yStart)));
		}
		// quadrante 3
		for (int xStart = x, yStart = y; xStart > 0 && yStart < 7;) {
			moviments.add(new Moviment(new Position(x, y), new Position(--xStart, ++yStart)));
		}
		// quadrante 4
		for (int xStart = x, yStart = y; xStart > 0 && yStart > 0;) {
			moviments.add(new Moviment(new Position(x, y), new Position(--xStart, --yStart)));
		}
		Moviment[] movimentArray = new Moviment[moviments.size()];
		int cont = 0;
		for (Moviment moviment : moviments)
			movimentArray[cont++] = moviment;
		return movimentArray;
	}

}
